package com.fluxtah.jordl.generator;

import com.fluxtah.jordl.generator.CodeGenerationContext;
import com.fluxtah.jordl.generator.strategy.CodeGenerationStrategy;
import com.fluxtah.jordl.generator.strategy.CodeGenerationStrategyFactory;
import com.fluxtah.jordl.model.JordlModule;
import com.google.inject.Inject;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.xbase.lib.IterableExtensions;

@SuppressWarnings("all")
public class JordlGenerator implements IGenerator {
  @Inject
  private CodeGenerationStrategyFactory codeGenerationStrategyFactory;
  
  public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
      CodeGenerationContext _codeGenerationContext = new CodeGenerationContext();
      CodeGenerationContext cgContext = _codeGenerationContext;
      CodeGenerationStrategyFactory _codeGenerationStrategyFactory = this.codeGenerationStrategyFactory;
      CodeGenerationStrategy _create = _codeGenerationStrategyFactory.create(cgContext, null);
      CodeGenerationStrategy strategy = _create;
      EList<EObject> _contents = resource.getContents();
      EObject _head = IterableExtensions.<EObject>head(_contents);
      strategy.generate(fsa, ((JordlModule) _head));
  }
}
